#!/bin/bash

# 镜像参数
namespace=$1
deployment=$2
container=$3
imageName=$4

kubectl set image deployment $deployment $container=$imageName -n $namespace
if [ $? -ne 0 ]; then
    echo "*** 更新deploy失败 ***"
    exit 1
fi

# 检查更新状态
kubectl rollout status deployment $deployment -n $namespace
if [ $? -ne 0 ]; then
    echo "*** 容器启动失败 ***"
    exit 1
fi

echo "### 启动容器成功 ###"